package net.realsee.gcl.domain.bo.mes;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * HIK回调实体
 *
 * @author 孙正华
 * @since 2023/8/18 10:04
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class GclMesOperateResult {

    /**
     * 返回结果 OK、NG
     */
    @JsonProperty(value = "Result")
    private String result;

    /**
     * 异常代码
     */
    @JsonProperty(value = "ErrorCode")
    private String errorCode;

    /**
     * 错误内容
     */
    @JsonProperty(value = "Message")
    private String message;

    public static GclMesOperateResult ok() {
        return GclMesOperateResult.builder().result("OK").errorCode("OK").message("OK").build();
    }

    public boolean isSuccess() {
        return StrUtil.equalsIgnoreCase("OK", this.result);
    }
}
